﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using DynSim.EntityFramework;
using DynSim.Basics;

namespace DynSim.Entities
{
    // TODO!!
    [Serializable]
    public class DirectionalLight : IEntity, IHideable, IMoveable, IRotatable
    {
        public string name { get; set; }

        public Color color;
        BasicEffect effect;
        public Vector3 position, direction;

        BaseEngine engine;

        bool show = true;

        public DirectionalLight(Color color, Vector3 position, Vector3 direction, BaseEngine engine, Game game, string name)
        {
            this.name = name;

            this.color = color;
            this.engine = engine;
            this.position = position;
            this.direction = direction;

            this.effect = new BasicEffect(game.GraphicsDevice);
        }

        public void Draw(GameTime gameTime)
        {
            if (show)
            {
                
            }
        }

        public void Initialize()
        {
            
        }

        public void Update(GameTime gameTime)
        {
            if (show)
            {
                effect.View = engine.camera.view;
                effect.Projection = engine.camera.projection;
                effect.World = Matrix.CreateWorld(position, direction, Vector3.Up);
            }
        }

        public void Show()
        {
            this.show = true;
        }

        public void Hide()
        {
            this.show = false;
        }

        public void Move(Vector3 position)
        {
            this.position = position;
        }

        public void Rotate(Vector3 rotation)
        {
            
        }
    }
}
